<include file='Index/header'/>
<script language="javascript" type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>
<style>
    hr {
        height: 1px;
        margin: 0 0 0 0;

    }

    /*#class {*/
        /*height: 30px;*/
        /*width: 100px;*/
    /*}*/

    td {
        line-height: 30px;

    }

</style>
<include file='Index/left'/>


<div class="content">
    <div class="well well-sm" style="height:100px;">
        <ul class="nav nav-tabs">
            <li >
                <a href="javascript:void(0)" onclick="window.location.href='__CONTROLLER__/index2/fs/now.html'"
                                  data-toggle="tab">模式一</a>
            </li>
            <li class="active">
                <a href="javascript:void(0)" onclick="window.location.href='__CONTROLLER__/index'"
                   data-toggle="tab">模式二</a>
            </li>
        </ul>
        <form id="cx" name="cx" method="post">
            &nbsp;&nbsp;&nbsp;&nbsp;
            <lable>起止时间：</lable>
            <input type="text" name="start_time" onClick="WdatePicker()" placeholder="" style="width:120px">
            ~
            <input type="text" name="end_time" onClick="WdatePicker()" placeholder="" style="width:120px">


            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-primary" onclick="submit()">&nbsp;&nbsp;查&nbsp;&nbsp;询&nbsp;&nbsp;
            </button>
        </form>
    </div>

    <div style="margin-left:50px;text-align:center">
        <div class="tb">
            <table width="90%" border="1">
                <tr>
                    <td width="80" align="center" nowrap="nowrap" bgcolor="#999999">日期</td>
                    <td width="56" align="center" nowrap="nowrap" bgcolor="#999999">午别</td>
                    <td width="192" align="center" nowrap="nowrap" bgcolor="#999999">班次</td>
                    <td width="192" align="center" nowrap="nowrap" bgcolor="#999999">课程</td>

                    <td width="100" align="center" nowrap="nowrap" bgcolor="#999999">教室</td>
                    <td width="100" align="center" nowrap="nowrap" bgcolor="#999999">带班老师</td>
                    <td width="100" align="center" nowrap="nowrap" bgcolor="#999999">接班老师</td>

                </tr>

                <volist name='sq' id='vo' key='k'>

                    <tr>
                        <td rowspan="3" align="center"><p>{$key}</p>
                            <p>
                                <switch name="key|strtotime|date='w',###">
                                    <case value="1">(星期一)</case>
                                    <case value="2">(星期二)</case>
                                    <case value="3">(星期三)</case>
                                    <case value="4">(星期四)</case>
                                    <case value="5">(星期五)</case>
                                    <case value="6">(星期六)</case>
                                    <case value="0">(星期日)</case>
                                    <default/>
                                    数据错误
                                </switch>

                            </p>
                        </td>
                        <td align="center">上午</td>
                        <td align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')"><a
                                            href='javascript:void(0)' onclick="bcshow('{$vp.schedule_id}')">{$vp['schename']}</a>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>

                        <td align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                                <!--<p>-->
                            <!--<td>-->
                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')"><a
                                            href='javascript:void(0)'
                                            onclick="kcshow('{$vp.coursename}',{$vp.id})">{$vp['coursename']}</a>
                                        <hr/>
                                    </if>
                            <!--</td>-->
                            </volist>
                        </td>

                        <td height="20px">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                        <select name="class" id="class" onchange="saves({$vp['id']},this.value);">
                                            <if condition="$vp['class'] eq ''">
                                                <option value="0" selected="selected"></option>
                                                <else/>
                                                <option value="{$vp['class']}" selected="selected">{$vp['class']}
                                                </option>
                                            </if>
                                            <volist name='class' id='vcl'>
                                                <option value="{$vcl.classname}">{$vcl.classname}</option>

                                            </volist>
                                        </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>

                        <td  align="center" nowrap="nowrap" height="20px">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                        <select name="dteacher" id="dteacher"
                                                onchange="saves2({$vp['courseid']},this.value);" style="width:100px">
                                            <if condition="$vp['dteacher'] eq ''">
                                                <option value="0" selected="selected"></option>
                                                <else/>
                                                <option value="{$vp['dteacher']}" selected="selected">
                                                    {$vp['dteacher']}
                                                </option>
                                            </if>
                                            <volist name='teacher' id='vc2'>
                                                <option value="{$vc2.tname}">{$vc2.tname}</option>

                                            </volist>
                                        </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>
                        <td  align="center" nowrap="nowrap" height="20px">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '1') or ($vp['is_am2'] eq '1')">
                                        <select name="jteacher" id="jteacher"
                                                onchange="saves3({$vp['courseid']},this.value);" style="width:100px">
                                            <if condition="$vp['jteacher'] eq ''">
                                                <option value="0" selected="selected"></option>
                                                <else/>
                                                <option value="{$vp['jteacher']}" selected="selected">
                                                    {$vp['jteacher']}
                                                </option>
                                            </if>
                                            <volist name='teacher' id='vc2'>
                                                <option value="{$vc2.tname}">{$vc2.tname}</option>

                                            </volist>
                                        </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>

                    </tr>
                    <tr>
                        <td align="center" height="38">下午</td>
                        <td align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')"><a
                                            href='javascript:void(0)' onclick="bcshow('{$vp.schedule_id}')">{$vp['schename']}</a>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>
                        <td align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')"><a
                                            href='javascript:void(0)'
                                            onclick="kcshow('{$vp.coursename}',{$vp.id})">{$vp['coursename']}</a>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>

                        <td height="35" align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')"><select name="class"
                                                                                                            id="class"
                                                                                                            onchange="saves({$vp['id']},this.value);">
                                        <if condition="$vp['class'] eq ''">
                                            <option value="" selected="selected"></option>
                                            <else/>
                                            <option value="{$vp['class']}" selected="selected">{$vp['class']}</option>
                                        </if>
                                        <volist name='class' id='vcl'>
                                            <option value="{$vcl.classname}">{$vcl.classname}</option>

                                        </volist>
                                    </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>
                        <td height="35" align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                        <select name="dteacher" id="dteacher"
                                                onchange="saves2({$vp['courseid']},this.value);" style="width:100px">
                                            <if condition="$vp['dteacher'] eq ''">
                                                <option value="0" selected="selected"></option>
                                                <else/>
                                                <option value="{$vp['dteacher']}" selected="selected">
                                                    {$vp['dteacher']}
                                                </option>
                                            </if>
                                            <volist name='teacher' id='vc2'>
                                                <option value="{$vc2.tname}">{$vc2.tname}</option>

                                            </volist>
                                        </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>

                        <td height="35" align="center" nowrap="nowrap">
                            <volist name='vo' id='vp'>
                                <!--<p>-->
                                    <if condition="($vp['is_am'] eq '2') or ($vp['is_am2'] eq '2')">
                                        <select name="jteacher" id="jteacher"
                                                onchange="saves3({$vp['courseid']},this.value);" style="width:100px">
                                            <if condition="$vp['jteacher'] eq ''">
                                                <option value="0" selected="selected"></option>
                                                <else/>
                                                <option value="{$vp['jteacher']}" selected="selected">
                                                    {$vp['jteacher']}
                                                </option>
                                            </if>
                                            <volist name='teacher' id='vc2'>
                                                <option value="{$vc2.tname}">{$vc2.tname}</option>

                                            </volist>
                                        </select>
                                        <hr/>
                                    </if>
                                <!--</p>-->
                            </volist>
                        </td>
                    </tr>
                    <td align="center" height="38">晚上</td>
                    <td align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                            <!--<p>-->
                                <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')"><a
                                        href='javascript:void(0)'
                                        onclick="bcshow('{$vp.schedule_id}')">{$vp['schename']}</a>
                                    <hr/>
                                </if>
                            <!--</p>-->
                        </volist>
                    </td>
                    <td align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                            <!--<p>-->
                                <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')"><a
                                        href='javascript:void(0)' onclick="kcshow('{$vp.coursename}',{$vp.id})">{$vp['coursename']}</a>
                                    <hr/>
                                </if>
                            <!--</p>-->
                        </volist>
                    </td>

                    <td height="35" align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                            <!--<p>-->
                                <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')"><select name="class"
                                                                                                        id="class"
                                                                                                        onchange="saves({$vp['id']},this.value);">
                                    <if condition="$vp['class'] eq ''">
                                        <option value="" selected="selected"></option>
                                        <else/>
                                        <option value="{$vp['class']}" selected="selected">{$vp['class']}</option>
                                    </if>
                                    <volist name='class' id='vcl'>
                                        <option value="{$vcl.classname}">{$vcl.classname}</option>

                                    </volist>
                                </select>
                                    <hr/>
                                </if>
                            <!--</p>-->
                        </volist>
                    </td>
                    <td height="35" align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                            <!--<p>-->
                                <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                    <select name="dteacher" id="dteacher"
                                            onchange="saves2({$vp['courseid']},this.value);" style="width:100px">
                                        <if condition="$vp['dteacher'] eq ''">
                                            <option value="0" selected="selected"></option>
                                            <else/>
                                            <option value="{$vp['dteacher']}" selected="selected">{$vp['dteacher']}
                                            </option>
                                        </if>
                                        <volist name='teacher' id='vc2'>
                                            <option value="{$vc2.tname}">{$vc2.tname}</option>

                                        </volist>
                                    </select>
                                    <hr/>
                                </if>
                            <!--</p>-->
                        </volist>
                    </td>

                    <td height="35" align="center" nowrap="nowrap">
                        <volist name='vo' id='vp'>
                            <!--<p>-->
                                <if condition="($vp['is_am'] eq '3') or ($vp['is_am2'] eq '3')">
                                    <select name="jteacher" id="jteacher"
                                            onchange="saves3({$vp['courseid']},this.value);" style="width:100px">
                                        <if condition="$vp['jteacher'] eq ''">
                                            <option value="0" selected="selected"></option>
                                            <else/>
                                            <option value="{$vp['jteacher']}" selected="selected">{$vp['jteacher']}
                                            </option>
                                        </if>
                                        <volist name='teacher' id='vc2'>
                                            <option value="{$vc2.tname}">{$vc2.tname}</option>

                                        </volist>
                                    </select>
                                    <hr/>
                                </if>
                            <!--</p>-->
                        </volist>
                    </td>
                    </tr>

                </volist>
            </table>
        </div>


    </div>
    <br/>
    <div style='text-align:center'>
        <if condition="$sd neq ''">
            <div>
                <a href="{:U('Index/index',array('fs'=>'up','sd'=>$sd))}">
                    <button type="button" class="btn btn-default btn-lg">上一周</button>
                </a>
                &nbsp;&nbsp;| &nbsp;&nbsp;
                <a href="{:U('Index/index',array('fs'=>'now'))}">
                    <button type="button" class="btn btn-default btn-lg">本周</button>
                </a>
                    &nbsp;&nbsp;|&nbsp;&nbsp;
                <a href="{:U('Index/index',array('fs'=>'down','sd'=>$sd))}">
                    <button type="button" class="btn btn-default btn-lg">下一周</button>
                </a>

            </div>
        </if>
    </div>
    <div class="container-fluid">
        <div class="row-fluid">


            <div class="row-fluid">

                <div class="alert alert-info">
                    <button type="button" class="close" data-dismiss="alert">×</button>
                    <h4>Ver:</h4> 1.0.0
                </div>
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                     aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close"
                                        data-dismiss="modal" aria-hidden="true">
                                    &times;
                                </button>
                                <h4 class="modal-title" id="myModalLabel">
                                    课程信息
                                </h4>
                            </div>
                            <div>
                                <div id='listsp'></div>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal -->
                </div>
                <div class="modal fade" id="myModal2" tabindex="-1" role="dialog"
                     aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close"
                                        data-dismiss="modal" aria-hidden="true">
                                    &times;
                                </button>
                                <h4 class="modal-title" id="myModalLabel">

                                </h4>
                            </div>
                            <div>
                                <div id='listsp2'></div>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal -->
                </div>
            </div>
            <script type="text/javascript">
                function saves(id, value) {
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/saveclass",

                        cache: false,
                        data: {
                            id: id,
                            value: value

                        },

                        success: function (data) {
                            window.location.reload();
                        }

                    });


                }

                function saves2(id, value) {
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/savedteacher",

                        cache: false,
                        data: {
                            id: id,
                            value: value

                        },

                        success: function (data) {
                            window.location.reload();
                        }

                    });


                }

                function saves3(id, value) {
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/savejteacher",

                        cache: false,
                        data: {
                            id: id,
                            value: value

                        },

                        success: function (data) {
                            window.location.reload();
                        }

                    });


                }

                function kcshow(bcbh, bh) {
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/kcshow",

                        cache: false,
                        data: {
                            kcname: bcbh,
                            bh: bh

                        },

                        success: function (data) {

                            $('#listsp').html(data);
                            $('#myModal').modal('show');
                            $('#myModal').modal().css({
                                width: '1000px',
                                height: '500px',
                                'margin-left': function () {
                                    return -($(this).width() / 2);
                                }
                            });
                        }


                    });


                }

                function bcshow(bcbh) {
                    // alert(bcbh);exit;
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/bcshow",

                        cache: false,
                        data: {
                            bcmc: bcbh

                        },

                        success: function (data) {

                            $('#listsp2').html(data);
                            $('#myModal2').modal('show');
                            $('#myModal2').modal().css({
                                width: '1000px',
                                height: '500px',
                                'margin-left': function () {
                                    return -($(this).width() / 2);
                                }
                            });
                        }


                    })


                }
            </script>

            <include file='Index/footer'/>
 